Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

improve AnnotationInstance.hashCode() #329

Merged
merged 1 commit into from
Sep 22, 2023

Conversation

Ladicek
Copy link
Contributor

@Ladicek Ladicek commented Sep 21, 2023

The AnnotationInstance.equals() method considers two annotations that are basically the same as distinct if they don't have the same target. However, the AnnotationInstance.hashCode() method does not take the target into account at all, which leads to hash table collisions. This commit uses the AnnotationTarget information to spread out the AnnotationInstance hash code to make collisions less likely.

The `AnnotationInstance.equals()` method considers two annotations that are
basically the same as distinct if they don't have the same `target`. However,
the `AnnotationInstance.hashCode()` method does not take the `target` into
account at all, which leads to hash table collisions. This commit uses
the `AnnotationTarget` information to spread out the `AnnotationInstance`
hash code to make collisions less likely.
@Ladicek Ladicek added this to the 3.1.4 milestone Sep 21, 2023
@Ladicek Ladicek merged commit c9d5476 into smallrye:main Sep 22, 2023
39 checks passed
@Ladicek Ladicek deleted the annotation-hash-code branch September 22, 2023 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant